import xlwings as xw

#header("Content-type: text/html; charset=utf-8");
#$output = shell_exec('python script/test.py 参数1 参数2');


#建立excel表连接

app = xw.App(visible=False, add_book=False)

#wb = xw.Book(r"e:\pythonroot\demo\demo.xls")

# 显示警报（）
app.display_alerts = True
# 屏幕更新（应用中）
app.screen_updating = True
# 打开文件
wb = app.books.open('e:\pythonroot\demo\demo.xlsx')


#实例化工作表对象
sht = wb.sheets["明细表"]

info = sht.used_range

nrows = info.last_cell.row
print(nrows)

ncolumns = info.last_cell.column
print(ncolumns)

# 遍历读取单元格
column_name = ['A','B',"C",'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI']
data_list = [] #将数据存到list中去
for i in range(nrows): # 遍历行
 row_list = []
 for j in range(33): #遍历列
     str1 = column_name[j]+str(i+1)
     a = sht.range(str1).value
     #row_list.append(j)
     print(a)
     pass
 #data_list.append(row_list)
 pass
#print(data_list)

wb.close()
app.quit()


